package com.itlong.cloud.tapd.util;

import org.apache.commons.lang3.StringUtils;

import java.util.HashMap;
import java.util.List;

/**
 * <des>
 *统计满足条件的单数 类型 1 、2 、3
 * <des>
 *
 * @create Date 2021-09-08
 **/
public class GetCount {
    public static Integer GetCountNumber(String user,List<HashMap<String,Object>> taskList,List<HashMap<String,Object>> storyList,
                                         List<HashMap<String,Object>> bugList){
        HashMap<String,Integer> map = new HashMap<>();

        Integer count=0;
        if(taskList.size()>0) {
            for (HashMap<String, Object> task : taskList) {
                String owner = (String) task.get("owner");
                if (StringUtils.isNotBlank(owner)) {
                    if (owner.contains(user)) {
                        count++;
                    }
                }
            }
        }
        if(storyList.size()>0) {
            for (HashMap<String, Object> story : storyList) {
                String owner = (String) story.get("owner");
                if (StringUtils.isNotBlank(owner)) {
                    if (owner.contains(user)) {
                        count++;
                    }
                }
            }
        }
        if(bugList.size()>0) {
            for (HashMap<String, Object> bug : bugList) {
                String owner = (String) bug.get("owner");
                if (StringUtils.isNotBlank(owner)) {
                    if (owner.contains(user)) {
                        count++;
                    }
                }
            }
        }
        return count;
    }
}
